import 'package:flutter/material.dart';
import 'package:test_flutter/utils/factory/Fit.dart';

class EditText extends StatefulWidget {

  String title;
  String AssetName;
  bool enabled = true;
  var _Controller = new TextEditingController();


  EditText(this.title,this.AssetName,{this.enabled});

  @override
  EditTextState createState() => new EditTextState();


  /*获取输入框值*/
  String getValue(){
    return _Controller.text.toString();
  }

  /*设置输入框值*/
  setValue(String value){
    _Controller.text = value;
  }





}

class EditTextState extends State<EditText> {

  @override
  Widget build(BuildContext context) {
    return new Stack(
      alignment: FractionalOffset.bottomCenter,
      children: <Widget>[
        new Container(
          padding: EdgeInsets.only(
              left: Fit.scaleX(80),
              top: Fit.scaleX(50),
              right: Fit.scaleX(80),
              bottom: Fit.scaleX(10)),
          width: Fit.scaleX(1920),
          height: Fit.scaleY(180),
          color: Colors.white,
          child: new Row(
            children: <Widget>[
              new Image(
                  width: Fit.scaleX(80),
                  height: Fit.scaleY(80),
                  image: new ExactAssetImage(widget.AssetName)),
              new Expanded(
                  child: new Padding(
                padding: EdgeInsets.only(left: Fit.scaleX(45)),
                child: new TextField(
                  style: new TextStyle(
                      fontSize: Fit.scaleTextSize(40), color: Color(0xffcdcdcd)),
                  controller: widget._Controller,
                  decoration: new InputDecoration(
                      hintText: widget.title, border: InputBorder.none),
                  obscureText: false,
                  enabled: widget.enabled,
                ),
              )),
            ],
          ),
        ),
        new Align(
          child: new Padding(
            padding: new EdgeInsets.only(
                left: Fit.scaleX(50),
                right: Fit.scaleX(50)),
            child: Align(
              child: new Divider(
                height: 0.5,
                color: Colors.black26,
              ),
            ),
          ),
        ),
      ],
    );
  }

}
